<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>File::Spec::Mac - File::Spec for Mac OS (Classic) - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/File::Spec::Mac">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./File::Spec::Mac.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/File::Spec::Mac">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/File::Spec::Mac">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/File::Spec::Mac">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/File::Spec::Mac">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/File::Spec::Mac">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/File::Spec::Mac">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/File::Spec::Mac">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/File::Spec::Mac">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/File::Spec::Mac">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/File::Spec::Mac">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/File::Spec::Mac">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/File::Spec::Mac">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/File::Spec::Mac">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/File::Spec::Mac">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/File::Spec::Mac">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/File::Spec::Mac">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/File::Spec::Mac">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/File::Spec::Mac">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/File::Spec::Mac">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/File::Spec::Mac">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/File::Spec::Mac">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/File::Spec::Mac">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/File::Spec::Mac">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/File::Spec::Mac">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/File::Spec::Mac">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/File::Spec::Mac">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/File::Spec::Mac">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/File::Spec::Mac">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/File::Spec::Mac">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/File::Spec::Mac">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/File::Spec::Mac">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/File::Spec::Mac">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/File::Spec::Mac">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/File::Spec::Mac">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/File::Spec::Mac">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/File::Spec::Mac">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/File::Spec::Mac">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/File::Spec::Mac">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/File::Spec::Mac">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/File::Spec::Mac">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/File::Spec::Mac">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/File::Spec::Mac">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/File::Spec::Mac">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/File::Spec::Mac">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/File::Spec::Mac">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/File::Spec::Mac">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/File::Spec::Mac">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/File::Spec::Mac">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/File::Spec::Mac">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/File::Spec::Mac">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/File::Spec::Mac">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/File::Spec::Mac">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/File::Spec::Mac">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/File::Spec::Mac">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/File::Spec::Mac">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/File::Spec::Mac">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/File::Spec::Mac">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/File::Spec::Mac">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/File::Spec::Mac">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/File::Spec::Mac">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/File::Spec::Mac">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/File::Spec::Mac">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/File::Spec::Mac">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/File::Spec::Mac">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/File::Spec::Mac">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/File::Spec::Mac">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/File::Spec::Mac">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/File::Spec::Mac">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/File::Spec::Mac">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/File::Spec::Mac">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/File::Spec::Mac">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/File::Spec::Mac">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/File::Spec::Mac">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/File::Spec::Mac">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/File::Spec::Mac">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/File::Spec::Mac">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/File::Spec::Mac">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/File::Spec::Mac">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/File::Spec::Mac">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/File::Spec::Mac">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./File::Spec::Mac.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/File::Spec::Mac">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/File::Spec::Mac">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/File::Spec::Mac">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/File::Spec::Mac">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/File::Spec::Mac">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/File::Spec::Mac">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/File::Spec::Mac">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/File::Spec::Mac">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/File::Spec::Mac">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/File::Spec::Mac">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/File::Spec::Mac">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/File::Spec::Mac">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/File::Spec::Mac">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/File::Spec::Mac">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/File::Spec::Mac">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/File::Spec::Mac">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/File::Spec::Mac">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/File::Spec::Mac">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/File::Spec::Mac">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/File::Spec::Mac">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/File::Spec::Mac">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/File::Spec::Mac">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/File::Spec::Mac">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/File::Spec::Mac">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/File::Spec::Mac">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/File::Spec::Mac">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/File::Spec::Mac">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/File::Spec::Mac">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/File::Spec::Mac">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/File::Spec::Mac">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/File::Spec::Mac">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/File::Spec::Mac">5.35.1</a>
          <a class="dropdown-item active" href="./File::Spec::Mac.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./File::Spec::Mac.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="./File::Spec::Mac.html">File::Spec::Mac</a>
          <div id="more">
            (<a href="./File::Spec::Mac.txt">source</a>,
            <a href="https://metacpan.org/pod/File::Spec::Mac">CPAN</a>)
          </div>
            <div id="moduleversion">version 3.80</div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="./File::Spec::Mac.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./File::Spec::Mac.html#SYNOPSIS">SYNOPSIS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./File::Spec::Mac.html#DESCRIPTION">DESCRIPTION</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./File::Spec::Mac.html#METHODS">METHODS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./File::Spec::Mac.html#AUTHORS">AUTHORS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./File::Spec::Mac.html#COPYRIGHT">COPYRIGHT</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./File::Spec::Mac.html#SEE-ALSO">SEE ALSO</a>
              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="./File::Spec::Mac.html#NAME">#</a>NAME</h1>

<p>File::Spec::Mac - File::Spec for Mac OS (Classic)</p>

<h1 id="SYNOPSIS"><a class="permalink" href="./File::Spec::Mac.html#SYNOPSIS">#</a>SYNOPSIS</h1>

<pre><code>require File::Spec::Mac; # Done internally by File::Spec if needed</code></pre>

<h1 id="DESCRIPTION"><a class="permalink" href="./File::Spec::Mac.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<p>Methods for manipulating file specifications.</p>

<h1 id="METHODS"><a class="permalink" href="./File::Spec::Mac.html#METHODS">#</a>METHODS</h1>

<dl>

<dt id="canonpath"><a class="permalink" href="./File::Spec::Mac.html#canonpath">#</a>canonpath</dt>
<dd>

<p>On Mac OS, there&#39;s nothing to be done. Returns what it&#39;s given.</p>

</dd>
<dt id="catdir()"><a class="permalink" href="./File::Spec::Mac.html#catdir()">#</a><a id="catdir"></a>catdir()</dt>
<dd>

<p>Concatenate two or more directory names to form a path separated by colons (&quot;:&quot;) ending with a directory. Resulting paths are <b>relative</b> by default, but can be forced to be absolute (but avoid this, see below). Automatically puts a trailing &quot;:&quot; on the end of the complete path, because that&#39;s what&#39;s done in MacPerl&#39;s environment and helps to distinguish a file path from a directory path.</p>

<p><b>IMPORTANT NOTE:</b> Beginning with version 1.3 of this module, the resulting path is relative by default and <i>not</i> absolute. This decision was made due to portability reasons. Since <code>File::Spec-&gt;catdir()</code> returns relative paths on all other operating systems, it will now also follow this convention on Mac OS. Note that this may break some existing scripts.</p>

<p>The intended purpose of this routine is to concatenate <i>directory names</i>. But because of the nature of Macintosh paths, some additional possibilities are allowed to make using this routine give reasonable results for some common situations. In other words, you are also allowed to concatenate <i>paths</i> instead of directory names (strictly speaking, a string like &quot;:a&quot; is a path, but not a name, since it contains a punctuation character &quot;:&quot;).</p>

<p>So, beside calls like</p>

<pre><code class="plaintext">catdir(&quot;a&quot;) = &quot;:a:&quot;
catdir(&quot;a&quot;,&quot;b&quot;) = &quot;:a:b:&quot;
catdir() = &quot;&quot;                    (special case)</code></pre>

<p>calls like the following</p>

<pre><code class="plaintext">catdir(&quot;:a:&quot;) = &quot;:a:&quot;
catdir(&quot;:a&quot;,&quot;b&quot;) = &quot;:a:b:&quot;
catdir(&quot;:a:&quot;,&quot;b&quot;) = &quot;:a:b:&quot;
catdir(&quot;:a:&quot;,&quot;:b:&quot;) = &quot;:a:b:&quot;
catdir(&quot;:&quot;) = &quot;:&quot;</code></pre>

<p>are allowed.</p>

<p>Here are the rules that are used in <code>catdir()</code>; note that we try to be as compatible as possible to Unix:</p>

<ol>

<li><p>The resulting path is relative by default, i.e. the resulting path will have a leading colon.</p>

</li>
<li><p>A trailing colon is added automatically to the resulting path, to denote a directory.</p>

</li>
<li><p>Generally, each argument has one leading &quot;:&quot; and one trailing &quot;:&quot; removed (if any). They are then joined together by a &quot;:&quot;. Special treatment applies for arguments denoting updir paths like &quot;::lib:&quot;, see (4), or arguments consisting solely of colons (&quot;colon paths&quot;), see (5).</p>

</li>
<li><p>When an updir path like &quot;:::lib::&quot; is passed as argument, the number of directories to climb up is handled correctly, not removing leading or trailing colons when necessary. E.g.</p>

<pre><code class="plaintext">catdir(&quot;:::a&quot;,&quot;::b&quot;,&quot;c&quot;)    = &quot;:::a::b:c:&quot;
catdir(&quot;:::a::&quot;,&quot;::b&quot;,&quot;c&quot;)  = &quot;:::a:::b:c:&quot;</code></pre>

</li>
<li><p>Adding a colon &quot;:&quot; or empty string &quot;&quot; to a path at <i>any</i> position doesn&#39;t alter the path, i.e. these arguments are ignored. (When a &quot;&quot; is passed as the first argument, it has a special meaning, see (6)). This way, a colon &quot;:&quot; is handled like a &quot;.&quot; (curdir) on Unix, while an empty string &quot;&quot; is generally ignored (see <a href="./File::Spec::Unix.html#canonpath%28%29">&quot;canonpath()&quot; in File::Spec::Unix</a> ). Likewise, a &quot;::&quot; is handled like a &quot;..&quot; (updir), and a &quot;:::&quot; is handled like a &quot;../..&quot; etc. E.g.</p>

<pre><code class="plaintext">catdir(&quot;a&quot;,&quot;:&quot;,&quot;:&quot;,&quot;b&quot;)   = &quot;:a:b:&quot;
catdir(&quot;a&quot;,&quot;:&quot;,&quot;::&quot;,&quot;:b&quot;) = &quot;:a::b:&quot;</code></pre>

</li>
<li><p>If the first argument is an empty string &quot;&quot; or is a volume name, i.e. matches the pattern /^[^:]+:/, the resulting path is <b>absolute</b>.</p>

</li>
<li><p>Passing an empty string &quot;&quot; as the first argument to <code>catdir()</code> is like passing<code>File::Spec-&gt;rootdir()</code> as the first argument, i.e.</p>

<pre><code class="plaintext">catdir(&quot;&quot;,&quot;a&quot;,&quot;b&quot;)          is the same as

catdir(rootdir(),&quot;a&quot;,&quot;b&quot;).</code></pre>

<p>This is true on Unix, where <code>catdir(&quot;&quot;,&quot;a&quot;,&quot;b&quot;)</code> yields &quot;/a/b&quot; and <code>rootdir()</code> is &quot;/&quot;. Note that <code>rootdir()</code> on Mac OS is the startup volume, which is the closest in concept to Unix&#39; &quot;/&quot;. This should help to run existing scripts originally written for Unix.</p>

</li>
<li><p>For absolute paths, some cleanup is done, to ensure that the volume name isn&#39;t immediately followed by updirs. This is invalid, because this would go beyond &quot;root&quot;. Generally, these cases are handled like their Unix counterparts:</p>

<pre><code>Unix:
   Unix-&gt;catdir(&quot;&quot;,&quot;&quot;)                 =  &quot;/&quot;
   Unix-&gt;catdir(&quot;&quot;,&quot;.&quot;)                =  &quot;/&quot;
   Unix-&gt;catdir(&quot;&quot;,&quot;..&quot;)               =  &quot;/&quot;        # can&#39;t go
                                                     # beyond root
   Unix-&gt;catdir(&quot;&quot;,&quot;.&quot;,&quot;..&quot;,&quot;..&quot;,&quot;a&quot;)  =  &quot;/a&quot;
Mac:
   Mac-&gt;catdir(&quot;&quot;,&quot;&quot;)                  =  rootdir()  # (e.g. &quot;HD:&quot;)
   Mac-&gt;catdir(&quot;&quot;,&quot;:&quot;)                 =  rootdir()
   Mac-&gt;catdir(&quot;&quot;,&quot;::&quot;)                =  rootdir()  # can&#39;t go
                                                     # beyond root
   Mac-&gt;catdir(&quot;&quot;,&quot;:&quot;,&quot;::&quot;,&quot;::&quot;,&quot;a&quot;)   =  rootdir() . &quot;a:&quot;
                                                   # (e.g. &quot;HD:a:&quot;)</code></pre>

<p>However, this approach is limited to the first arguments following &quot;root&quot; (again, see <a href="./File::Spec::Unix.html#canonpath%28%29">&quot;canonpath()&quot; in File::Spec::Unix</a>. If there are more arguments that move up the directory tree, an invalid path going beyond root can be created.</p>

</li>
</ol>

<p>As you&#39;ve seen, you can force <code>catdir()</code> to create an absolute path by passing either an empty string or a path that begins with a volume name as the first argument. However, you are strongly encouraged not to do so, since this is done only for backward compatibility. Newer versions of File::Spec come with a method called <code>catpath()</code> (see below), that is designed to offer a portable solution for the creation of absolute paths. It takes volume, directory and file portions and returns an entire path. While <code>catdir()</code> is still suitable for the concatenation of <i>directory names</i>, you are encouraged to use <code>catpath()</code> to concatenate <i>volume names</i> and <i>directory paths</i>. E.g.</p>

<pre><code>$dir      = File::Spec-&gt;catdir(&quot;tmp&quot;,&quot;sources&quot;);
$abs_path = File::Spec-&gt;catpath(&quot;MacintoshHD:&quot;, $dir,&quot;&quot;);</code></pre>

<p>yields</p>

<pre><code class="plaintext">&quot;MacintoshHD:tmp:sources:&quot; .</code></pre>

</dd>
<dt id="catfile"><a class="permalink" href="./File::Spec::Mac.html#catfile">#</a>catfile</dt>
<dd>

<p>Concatenate one or more directory names and a filename to form a complete path ending with a filename. Resulting paths are <b>relative</b> by default, but can be forced to be absolute (but avoid this).</p>

<p><b>IMPORTANT NOTE:</b> Beginning with version 1.3 of this module, the resulting path is relative by default and <i>not</i> absolute. This decision was made due to portability reasons. Since <code>File::Spec-&gt;catfile()</code> returns relative paths on all other operating systems, it will now also follow this convention on Mac OS. Note that this may break some existing scripts.</p>

<p>The last argument is always considered to be the file portion. Since <code>catfile()</code> uses <code>catdir()</code> (see above) for the concatenation of the directory portions (if any), the following with regard to relative and absolute paths is true:</p>

<pre><code class="plaintext">catfile(&quot;&quot;)     = &quot;&quot;
catfile(&quot;file&quot;) = &quot;file&quot;</code></pre>

<p>but</p>

<pre><code class="plaintext">catfile(&quot;&quot;,&quot;&quot;)        = rootdir()         # (e.g. &quot;HD:&quot;)
catfile(&quot;&quot;,&quot;file&quot;)    = rootdir() . file  # (e.g. &quot;HD:file&quot;)
catfile(&quot;HD:&quot;,&quot;file&quot;) = &quot;HD:file&quot;</code></pre>

<p>This means that <code>catdir()</code> is called only when there are two or more arguments, as one might expect.</p>

<p>Note that the leading &quot;:&quot; is removed from the filename, so that</p>

<pre><code class="plaintext">catfile(&quot;a&quot;,&quot;b&quot;,&quot;file&quot;)  = &quot;:a:b:file&quot;    and

catfile(&quot;a&quot;,&quot;b&quot;,&quot;:file&quot;) = &quot;:a:b:file&quot;</code></pre>

<p>give the same answer.</p>

<p>To concatenate <i>volume names</i>, <i>directory paths</i> and <i>filenames</i>, you are encouraged to use <code>catpath()</code> (see below).</p>

</dd>
<dt id="curdir"><a class="permalink" href="./File::Spec::Mac.html#curdir">#</a>curdir</dt>
<dd>

<p>Returns a string representing the current directory. On Mac OS, this is &quot;:&quot;.</p>

</dd>
<dt id="devnull"><a class="permalink" href="./File::Spec::Mac.html#devnull">#</a>devnull</dt>
<dd>

<p>Returns a string representing the null device. On Mac OS, this is &quot;Dev:Null&quot;.</p>

</dd>
<dt id="rootdir"><a class="permalink" href="./File::Spec::Mac.html#rootdir">#</a>rootdir</dt>
<dd>

<p>Returns the empty string. Mac OS has no real root directory.</p>

</dd>
<dt id="tmpdir"><a class="permalink" href="./File::Spec::Mac.html#tmpdir">#</a>tmpdir</dt>
<dd>

<p>Returns the contents of $ENV{TMPDIR}, if that directory exits or the current working directory otherwise. Under MacPerl, $ENV{TMPDIR} will contain a path like &quot;MacintoshHD:Temporary Items:&quot;, which is a hidden directory on your startup volume.</p>

</dd>
<dt id="updir"><a class="permalink" href="./File::Spec::Mac.html#updir">#</a>updir</dt>
<dd>

<p>Returns a string representing the parent directory. On Mac OS, this is &quot;::&quot;.</p>

</dd>
<dt id="file_name_is_absolute"><a class="permalink" href="./File::Spec::Mac.html#file_name_is_absolute">#</a>file_name_is_absolute</dt>
<dd>

<p>Takes as argument a path and returns true, if it is an absolute path. If the path has a leading &quot;:&quot;, it&#39;s a relative path. Otherwise, it&#39;s an absolute path, unless the path doesn&#39;t contain any colons, i.e. it&#39;s a name like &quot;a&quot;. In this particular case, the path is considered to be relative (i.e. it is considered to be a filename). Use &quot;:&quot; in the appropriate place in the path if you want to distinguish unambiguously. As a special case, the filename &#39;&#39; is always considered to be absolute. Note that with version 1.2 of File::Spec::Mac, this does no longer consult the local filesystem.</p>

<p>E.g.</p>

<pre><code>File::Spec-&gt;file_name_is_absolute(&quot;a&quot;);         # false (relative)
File::Spec-&gt;file_name_is_absolute(&quot;:a:b:&quot;);     # false (relative)
File::Spec-&gt;file_name_is_absolute(&quot;MacintoshHD:&quot;);
                                                # true (absolute)
File::Spec-&gt;file_name_is_absolute(&quot;&quot;);          # true (absolute)</code></pre>

</dd>
<dt id="path"><a class="permalink" href="./File::Spec::Mac.html#path">#</a>path</dt>
<dd>

<p>Returns the null list for the MacPerl application, since the concept is usually meaningless under Mac OS. But if you&#39;re using the MacPerl tool under MPW, it gives back $ENV{Commands} suitably split, as is done in :lib:ExtUtils:MM_Mac.pm.</p>

</dd>
<dt id="splitpath"><a class="permalink" href="./File::Spec::Mac.html#splitpath">#</a>splitpath</dt>
<dd>

<pre><code>($volume,$directories,$file) = File::Spec-&gt;splitpath( $path );
($volume,$directories,$file) = File::Spec-&gt;splitpath( $path,
                                                      $no_file );</code></pre>

<p>Splits a path into volume, directory, and filename portions.</p>

<p>On Mac OS, assumes that the last part of the path is a filename unless $no_file is true or a trailing separator &quot;:&quot; is present.</p>

<p>The volume portion is always returned with a trailing &quot;:&quot;. The directory portion is always returned with a leading (to denote a relative path) and a trailing &quot;:&quot; (to denote a directory). The file portion is always returned <i>without</i> a leading &quot;:&quot;. Empty portions are returned as empty string &#39;&#39;.</p>

<p>The results can be passed to <code>catpath()</code> to get back a path equivalent to (usually identical to) the original path.</p>

</dd>
<dt id="splitdir"><a class="permalink" href="./File::Spec::Mac.html#splitdir">#</a>splitdir</dt>
<dd>

<p>The opposite of <code>catdir()</code>.</p>

<pre><code>@dirs = File::Spec-&gt;splitdir( $directories );</code></pre>

<p>$directories should be only the directory portion of the path on systems that have the concept of a volume or that have path syntax that differentiates files from directories. Consider using <code>splitpath()</code> otherwise.</p>

<p>Unlike just splitting the directories on the separator, empty directory names (<code>&quot;&quot;</code>) can be returned. Since <code>catdir()</code> on Mac OS always appends a trailing colon to distinguish a directory path from a file path, a single trailing colon will be ignored, i.e. there&#39;s no empty directory name after it.</p>

<p>Hence, on Mac OS, both</p>

<pre><code>File::Spec-&gt;splitdir( &quot;:a:b::c:&quot; );    and
File::Spec-&gt;splitdir( &quot;:a:b::c&quot; );</code></pre>

<p>yield:</p>

<pre><code class="plaintext">( &quot;a&quot;, &quot;b&quot;, &quot;::&quot;, &quot;c&quot;)</code></pre>

<p>while</p>

<pre><code>File::Spec-&gt;splitdir( &quot;:a:b::c::&quot; );</code></pre>

<p>yields:</p>

<pre><code class="plaintext">( &quot;a&quot;, &quot;b&quot;, &quot;::&quot;, &quot;c&quot;, &quot;::&quot;)</code></pre>

</dd>
<dt id="catpath"><a class="permalink" href="./File::Spec::Mac.html#catpath">#</a>catpath</dt>
<dd>

<pre><code>$path = File::Spec-&gt;catpath($volume,$directory,$file);</code></pre>

<p>Takes volume, directory and file portions and returns an entire path. On Mac OS, $volume, $directory and $file are concatenated. A &#39;:&#39; is inserted if need be. You may pass an empty string for each portion. If all portions are empty, the empty string is returned. If $volume is empty, the result will be a relative path, beginning with a &#39;:&#39;. If $volume and $directory are empty, a leading &quot;:&quot; (if any) is removed form $file and the remainder is returned. If $file is empty, the resulting path will have a trailing &#39;:&#39;.</p>

</dd>
<dt id="abs2rel"><a class="permalink" href="./File::Spec::Mac.html#abs2rel">#</a>abs2rel</dt>
<dd>

<p>Takes a destination path and an optional base path and returns a relative path from the base path to the destination path:</p>

<pre><code>$rel_path = File::Spec-&gt;abs2rel( $path ) ;
$rel_path = File::Spec-&gt;abs2rel( $path, $base ) ;</code></pre>

<p>Note that both paths are assumed to have a notation that distinguishes a directory path (with trailing &#39;:&#39;) from a file path (without trailing &#39;:&#39;).</p>

<p>If $base is not present or &#39;&#39;, then the current working directory is used. If $base is relative, then it is converted to absolute form using <code>rel2abs()</code>. This means that it is taken to be relative to the current working directory.</p>

<p>If $path and $base appear to be on two different volumes, we will not attempt to resolve the two paths, and we will instead simply return $path. Note that previous versions of this module ignored the volume of $base, which resulted in garbage results part of the time.</p>

<p>If $base doesn&#39;t have a trailing colon, the last element of $base is assumed to be a filename. This filename is ignored. Otherwise all path components are assumed to be directories.</p>

<p>If $path is relative, it is converted to absolute form using <code>rel2abs()</code>. This means that it is taken to be relative to the current working directory.</p>

<p>Based on code written by Shigio Yamaguchi.</p>

</dd>
<dt id="rel2abs"><a class="permalink" href="./File::Spec::Mac.html#rel2abs">#</a>rel2abs</dt>
<dd>

<p>Converts a relative path to an absolute path:</p>

<pre><code>$abs_path = File::Spec-&gt;rel2abs( $path ) ;
$abs_path = File::Spec-&gt;rel2abs( $path, $base ) ;</code></pre>

<p>Note that both paths are assumed to have a notation that distinguishes a directory path (with trailing &#39;:&#39;) from a file path (without trailing &#39;:&#39;).</p>

<p>If $base is not present or &#39;&#39;, then $base is set to the current working directory. If $base is relative, then it is converted to absolute form using <code>rel2abs()</code>. This means that it is taken to be relative to the current working directory.</p>

<p>If $base doesn&#39;t have a trailing colon, the last element of $base is assumed to be a filename. This filename is ignored. Otherwise all path components are assumed to be directories.</p>

<p>If $path is already absolute, it is returned and $base is ignored.</p>

<p>Based on code written by Shigio Yamaguchi.</p>

</dd>
</dl>

<h1 id="AUTHORS"><a class="permalink" href="./File::Spec::Mac.html#AUTHORS">#</a>AUTHORS</h1>

<p>See the authors list in <i>File::Spec</i>. Mac OS support by Paul Schinder &lt;schinder@pobox.com&gt; and Thomas Wegner &lt;wegner_thomas@yahoo.com&gt;.</p>

<h1 id="COPYRIGHT"><a class="permalink" href="./File::Spec::Mac.html#COPYRIGHT">#</a>COPYRIGHT</h1>

<p>Copyright (c) 2004 by the Perl 5 Porters. All rights reserved.</p>

<p>This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p>

<h1 id="SEE-ALSO"><a class="permalink" href="./File::Spec::Mac.html#SEE-ALSO">#</a><a id="SEE"></a>SEE ALSO</h1>

<p>See <a href="./File::Spec.html">File::Spec</a> and <a href="./File::Spec::Unix.html">File::Spec::Unix</a>. This package overrides the implementation of these methods, not the semantics.</p>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
